<?php
/**
 * @since 2011. 12. 05
 * @author lch
 * Examples of reference /boards/board/view/
 **/
require_once WDK_PATH.'/tpu/captcha/securimage.php';
class Hp_Captcha extends WdkClass
{
	protected
		$width = 120,
		$height = 25,
		$perturbation = 0.3,
		$code_length = 5,
		$text_color = '#B5B5B5',
		$bg_color = '#EAEAEA',
		$audio_format = 'mp3',
		$use_audio = false,
		$instance = null;

	/**
	 * 	생성자
	 * @since 2011. 12. 05
	 * @author lch
	 */
	function __construct($data=array())
	{
		$this->instance = new Securimage();
	}

	public function createImage()
	{
		//Change some settings
		$this->instance->image_width     = $this->width;
		$this->instance->image_height    = $this->height;
		$this->instance->perturbation    = $this->perturbation;      // high level of distortion
		$this->instance->code_length     = $this->code_length;
		$this->instance->image_bg_color  = new Securimage_Color($this->bg_color);
		$this->instance->num_lines       = 0;
		$this->instance->noise_level     = 0;
		$this->instance->text_color      = new Securimage_Color($this->text_color);
		$this->instance->noise_color     = $this->instance->text_color;
		$this->instance->line_color      = new Securimage_Color("#cccccc");

		$this->instance->show();
	}

	public function createAudio()
	{
		$this->instance->audio_format = $this->audio_format;
		$this->instance->outputAudioFile();
	}

	public function check($code="")
	{
		return $this->instance->check($code);
	}
}